#include "udpserver.hpp"
#include <memory>
using namespace udpserver;
std::string func(const std::string &str)
{
    std::string ret = "hello ";
    ret += str;
    return ret;
}

int main(int argc, char *argv[])
{
    // if (argc != 3)
    // {
    //     std::cout << "usage : ./udpserver ip port" << std::endl;
    //     exit(1);
    // }
    // std::string ip = argv[1];
    // uint16_t port = std::stoi(argv[2]);
    // std::unique_ptr<UdpServer> server = std::make_unique<UdpServer>(ip, port);

    if (argc != 2)
    {
        std::cout << "usage : ./udpserver port" << std::endl;
        exit(1);
    }
    uint16_t port = std::stoi(argv[1]);

    // std::unique_ptr<UdpServer> server = std::make_unique<UdpServer>(port);
    std::unique_ptr<UdpServer> server = std::make_unique<UdpServer>(port,func);

    server->Init();
    server->Start();
    return 0;
}